<!DOCTYPE html>
<html>
<head>
<title>趣享商品管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../../include/resources.html">

<script type="text/javascript">
	var dataGrid;
	var winWidth =  600; //弹出窗口宽度
	var winHeight = 500; //弹出窗口高度
	var addTitle = "添加商品"; //添加窗口标题
	var addUrl =  "/modules/additional/enjoyGoods/append.html"; // 添加窗口链接地址
	var editTitle = "编辑商品"; //编辑窗口标题
	var editUrl =  "/modules/additional/enjoyGoods/modify.html"; //编辑窗口链接地址
	var detailTitle = "查看商品"; //编辑窗口标题
	var detailUrl =  "/modules/additional/enjoyGoods/detail.html"; //查看窗口链接地址
	var val1 = true;
	var val2 = false;
	
	$(function() {
		dataGrid = $('#dataGrid').datagrid({
			url : 'listJson.html',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : pageSize,
			pageNums :1,
			pageList : pageList,
			sortName : 'id',
			sortOrder : 'asc',
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			singleSelect:true,
			columns : [ [
			{ field: 'id', title: '编号', width: 50, checkbox : false},
			{ field: 'name', title: '名称', width: 100, sortable: false},
			{ field: 'prefecture', title: '专区', width: 50, checkbox : false},
			{ field: 'position', title: '位置', width: 50, sortable: false,
				formatter: function(value,row,index){
					if(value==9)
						return "隐藏";
					else
						return value;
				}
			},
			{ field: 'costPrice', title: '成本价', width: 50, checkbox : false},
			{ field: 'price', title: '销售价', width: 100, sortable: false},
//			{ field: 'amount', title: '总数', width: 100, sortable: false},
//			{ field: 'sendout', title: '已发放', width: 50, sortable:false},
			{ field: 'addTime', title: '添加时间', width: 150, sortable:false,
          	  	formatter: function(value,row,index){
          	  		return getLocalTime(value,4);
				}  
            },
//            { field: 'status', title: '状态', width: 60, sortable: false,
//				formatter: function(value,row,index){
//					if (value == 1) {
//						return "有库存";
//					} else if (value == 2) {
//						return "无库存";
//					} else {
//						return "-";
//					}
//				}
//			},
			
            {   field : 'action',
                title : '操作',
                width : 75,
                fixed : true,
                align : 'center',
                formatter : function(value, row, index) { //功能按钮添加
                    var str = '';
                    str += '<dl>';
					str += '<dt><a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',editTitle,winWidth,winHeight,editUrl);" title="'+editTitle+'">编辑</a><i class="iconfont">&#xe639;</i></dt>' ;
					str += '<dd><a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',detailTitle,winWidth,winHeight,detailUrl);" title="'+detailTitle+'">查看</a></dd>' ;
   					str += '</dl>'
                	return str;
                }
            },
            
			 ] ],
			toolbar : '#toolbar',
			onLoadSuccess : function() {
				$('#searchForm table').show();
				parent.$.messager.progress('close');
			}
		});
	});
</script>
</head>
<body style="padding:0 20px;" >
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text"  name="searchName" class="sInput" placeholder="输入商品名称进行搜索" autocomplete="off" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"/><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a>
					<!--<a href="javascript:;" class="advBtn" title="条件查询">条件查询 <i class="iconfont">&#xe638;</i></a>-->
	            	<!--<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>-->
	            </form>
            </div>
            <!--<form id="showAdw">-->
		        <!--<ul class="showAdw" style="display:none;">-->
		        	<!--<a href="javascript:void(0);"><i class="iconfont closeWin">&#xe63a;</i></a>-->
		        	<!--<li><span>状态</span><select name="status" class="type">-->
							<!--<option value="0">全部</option>-->
							<!--<option value="1">有库存</option>-->
							<!--<option value="2">无库存</option>-->
						<!--</select></li>-->
		       		<!--<li><span>&nbsp;</span><a href="javascript:void(0);" class="searchBtn sureBtn" onclick="$.fn.dataGridOptions.searchFun('#showAdw');">确定</a><a href="javascript:void(0);" class="searchBtn" onclick="$.fn.dataGridOptions.cleanFun('#searchForm');">重置</a></li>-->
		        <!--</ul>-->
	        <!--</form>-->
	        <div class="sRight">
                <a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>添加商品</a>
            </div>
		</div>
		<div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
			<table id="dataGrid"></table>
		</div>
	</div>
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>